package com.woniuxy.light_smart.service.imp;

import com.woniuxy.light_smart.dto.FacDto;
import com.woniuxy.light_smart.entity.Facility;
import com.woniuxy.light_smart.mapper.FacilityMapper;
import com.woniuxy.light_smart.service.FacilityService;
import com.woniuxy.light_smart.vo.FacEnvironmentVo;
import com.woniuxy.light_smart.vo.FacVo;
import com.woniuxy.light_smart.vo.LightPoleVo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class FacilityServiceImpl implements FacilityService {
    @Resource
    private FacilityMapper facilityMapper;

    @Override
    public int deleteByPrimaryKey(Long id) {
        return facilityMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insertSelective(Facility record) {
        return facilityMapper.insertSelective(record);
    }

    @Override
    public Facility selectByPrimaryKey(Long id) {
        return facilityMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(Facility record) {
        return facilityMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public List<LightPoleVo> getAllState(List<LightPoleVo> all) {
        for (int i = 0; i < all.size(); i++) {
            LightPoleVo vo = all.get(i);
            List<Integer> state = facilityMapper.getAllState(vo.getLpId());
            vo.setState1(state.get(0));
            vo.setState2(state.get(1));
            vo.setState3(state.get(2));
            vo.setState4(state.get(3));
            vo.setState5(state.get(4));
            vo.setState6(state.get(5));
        }
        return all;
    }

    @Override
    public List<FacVo> queryFac1(FacDto facDto) {
        return facilityMapper.queryFac1(facDto);
    }

    @Override
    public List<FacEnvironmentVo> queryFac6(FacDto facDto) {
        return facilityMapper.queryFac6(facDto);
    }

    @Override
    public int updateFac(FacDto facDto) {
        return facilityMapper.updateFac(facDto);
    }

    @Override
    public List<FacVo> queryFac2(FacDto facDto) {
        return facilityMapper.queryFac2(facDto);
    }

    @Override
    public List<FacVo> queryFac7(FacDto facDto) {
        return facilityMapper.queryFac7(facDto);
    }

    @Override
    public List<FacVo> queryFac3(FacDto facDto) {
        return facilityMapper.queryFac3(facDto);
    }

    @Override
    public List<FacVo> queryFac4(FacDto facDto) {
        return facilityMapper.queryFac4(facDto);
    }

    @Override
    public List<FacVo> queryFac5(FacDto facDto) {
        return facilityMapper.queryFac5(facDto);
    }

    @Override
    public List<FacVo> queryFac8(FacDto facDto) {
        return facilityMapper.queryFac8(facDto);
    }


}
